<template>
  <div class="layout-container">
    <div class=" " style="padding: 10px">
      <el-form
          label-position="left"
          label-width="120px"
          :model="form"
          style="max-width: 460px"
      >
        <el-form-item size="medium"  label="账号"
        :rules=" [
        { required: true, message: '账号必填', trigger: 'blur' },
        { min: 6, max: 20, message: '长度在6~20个字符串', trigger: 'blur' },
      ]"
        >
          <el-input  v-model="form.account" />
        </el-form-item>
        <el-form-item size="medium" label="昵称">
          <el-input v-model="form.nickname" />
        </el-form-item>

        <el-form-item  size="medium" label="状态" align="left">
          <el-radio-group   v-model="form.status">
            <el-radio size="medium" label="0" >正常</el-radio>
            <el-radio size="medium" label="1" >锁定</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item  size="medium" label="备注">
          <el-input rows="3" v-model="form.remark" type="textarea" />
        </el-form-item>
        <el-form-item  size="medium">
          <el-button type="primary" @click="onSubmit">提交</el-button>
          <el-button @click="this.$router.go(-1)">返回</el-button>
        </el-form-item>

      </el-form>
    </div>
  </div>
</template>

<script>
import { defineComponent, ref, reactive } from 'vue'
import { ElMessage } from 'element-plus'
import  { FormInstance, FormRules } from 'element-plus'
import { onMounted} from 'vue'
import {useRouter, useRoute} from 'vue-router'
import req from '@/utils/system/req'
export default defineComponent({
  name: '编辑',
  components: {

  },

  props:[],
  setup(props) {
    const router = useRouter();
    onMounted(() => {
      if (router.currentRoute.value.query.hasOwnProperty('id')){
        getData(router.currentRoute.value.query.id)
      }
    })
    let form = ref({})

    const loading = ref(true)
    const getData=(id)=>{
      req({
        url: '/member/get_data',
        method: 'get',
        params:{
          id:id
        }
      })
        .then(res => {
          if (res.code==0){
            form.value = res.data
          }
        })
        .catch(error => {

        })
        .finally(() => {
          loading.value = false
        })
    }


    return {
      form,
      getData,

    }
  }
})
</script>

<style lang="scss" scoped>

</style>